<template>
    <div class="login_card">
        <p>
            <input v-model="userInfo.username" type="text" />
        </p>
        <p>
            <input v-model="userInfo.password" type="text" />
        </p>
        <button @click="handleLogin">登录</button>
    </div>
</template>

<script lang="ts" setup>
import { reactive, ref } from "vue";
import { login } from "/@/api/auth";

const userInfo = reactive({
  username: "",
  password: "",
});

function handleLogin() {
  if (!userInfo.username || !userInfo.password) {
    alert("账号密码不能为空！");
  } else {
    login(userInfo).then((res) => {
      console.log(res);
    });
  }
}
</script>

<style>
</style>
